package day21_28.day21;
/**
 * 洗牌
 * https://www.nowcoder.com/practice/5a0a2c7e431e4fbbbb1ff32ac6e8dfa0?tpId=85&&tqId=29848&rp=1&ru=/activity/oj&qru=/ta/2017test/question-ranking
 */

import java.util.*;

public class Main01 {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        while (scn.hasNextLine()){
            int t = scn.nextInt() ;
            for (int j = 0; j < t; ++j) {
                int n = scn.nextInt();
                int k = scn.nextInt();
                int[] arr =  new int[2 * n];
                for (int i = 0; i < arr.length; i++) {
                    arr[i] = scn.nextInt();
                }
                fun1(k , arr);
            }
        }
    }
    public static void fun1(int k , int[] arr){
        for (int i = 0; i < k; i++) {
            fun2(arr);
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i] + " ");
        }
        System.out.println();

    }
    public static int[] fun2(int[] arr){
        Stack<Integer> stack = new Stack<>();
        for (int i = arr.length - 1; i >= arr.length / 2 ; i--) {
            stack.push(arr[i]);
            stack.push(arr[i - arr.length / 2]);
        }
        for (int i = 0; i < arr.length; i++) {
            arr[i] = stack.pop();
        }
        return arr;
    }
}
